import request from '@/utils/request'
import { rsaEncrypt } from '@/utils/commonUtil3'

// 供应商接口
// 获取供应商列表
export function getSupplierList(data) {
  return request({
    url: '/supplier/select',
    method: 'get',
    params: data
  })
}

// 合同接口
// 获取合同列表
export function getContractList(data) {
  return request({
    url: '/supplier/contract/select',
    method: 'get',
    params: data
  })
}

// 添加合同
export function addContractInfo(data) {
  const data1 = rsaEncrypt(data)
  return request({
    url: '/supplier/contract/insert',
    method: 'post',
    data: {
      'data': data1
    }
  })
}

// 获取合同详情
export function getContractInfo(data) {
  return request({
    url: '/supplier/contract/selectDetails',
    method: 'get',
    params: data
  })
}

// 修改合同信息
export function updateContractInfo(data) {
  const data1 = rsaEncrypt(data)
  return request({
    url: '/supplier/contract/update',
    method: 'put',
    data: {
      'data': data1
    }
  })
}

// 删除合同信息
export function delContract(data) {
  const data1 = rsaEncrypt(data)
  return request({
    url: '/supplier/contract/delete',
    method: 'delete',
    data: {
      'data': data1
    }
  })
}
// 分页条件获取供应商订单列表
export function getSupplierOrderList(data) {
  return request({
    url: '/supplierOrder/select',
    method: 'get',
    params: data
  })
}

// 获取可关联用户
export function getValidUserList(data) {
  return request({
    url: '/supplierUser/select',
    method: 'get',
    params: data
  })
}

// 查询供应商已关联用户
export function getSupplierUserId(data) {
  return request({
    url: '/supplierUser/selectBySupplier',
    method: 'get',
    params: data
  })
}

// 绑定用户
export function bindUser(data) {
  const data1 = rsaEncrypt(data)
  return request({
    url: '/supplierUser/bind',
    method: 'post',
    data: {
      'data': data1
    }
  })
}

// 删除绑定用户
export function delBindUser(data) {
  const data1 = rsaEncrypt(data)
  return request({
    url: '/supplierUser/delete',
    method: 'delete',
    data: {
      'data': data1
    }
  })
}

// 获取供应商订单详情
export function getSupplierOrderDetail(data) {
  return request({
    url: '/supplierOrder/selectDetails',
    method: 'get',
    params: data
  })
}
